import 'package:flutter/material.dart';
import 'CardContainer.dart';

///表示构建 横向 控件item
class CardContainerHorizontal extends CardContainer {
  CardContainerHorizontal(
      {Key? key,
      label,
      labelAlign,
      labelStyle,
      labelIconSize,
      labelWitch,
      content,
      rightIcon,
      errorText,
      visible,
      leftIcon,
      isRequired = false,
      autoValidate = false,
      showLine = false,
      hintLabel,
      readOnly,
      labelSuffix})
      : super(
          key: key,
          label: label,
          labelAlign: labelAlign,
          labelStyle: labelStyle,
          labelIconSize: labelIconSize,
          labelWitch: labelWitch,
          content: content,
          errorText: errorText,
          visible: visible,
          leftIcon: leftIcon,
          rightIcon: rightIcon,
          isRequired: isRequired,
          autoValidate: autoValidate,
          showLine: showLine,
          labelSuffix: labelSuffix,
          hintLabel: hintLabel,
          readOnly: readOnly,
        );

  @override
  buildView(BuildContext context) {
    // TODO: implement buildView
    return _buildContainer(context);
  }

  Widget _buildContainer(BuildContext context) {
    return buildContainer(
        context,
        Row(
          children: <Widget>[
            buildLabelBlock(context),
            Expanded(
              child: Padding(
                padding: (rightIcon != null
                    ? EdgeInsets.only(right: 0.0)
                    : EdgeInsets.only(right: 10.0)),
                child: buildDecoratedContent(context),
              ),
            ),
            buildRightDecoration(),
          ],
        ));
  }
}
